package com.ctrl.riveradministrator.mvp.presenter;

import android.util.Log;

import com.ctrl.riveradministrator.base.BaseObserver;
import com.ctrl.riveradministrator.base.BasePresenter;
import com.ctrl.riveradministrator.mvp.model.RiverPolicy;
import com.ctrl.riveradministrator.mvp.view.activity.river_policy.RiverPolicyView;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class RiverPolicyPresenter extends BasePresenter<RiverPolicyView> {

    public RiverPolicyPresenter(RiverPolicyView baseView) {
        super(baseView);
    }

    public void getRiverPolicy(String riverId) {
        Map<String, String> map = new HashMap<>();
        map.put("id", riverId);
        attachView(apiService.getRiverPolicy(map), new BaseObserver<RiverPolicy>(getBaseView()) {

            @Override
            public void onSuccess(RiverPolicy model) {
                getBaseView().showMessage(model);
            }

            @Override
            public void onSuccess(List<RiverPolicy> model) {

            }

            @Override
            public void onFailed(String msg) {
                if(msg.equals("不存在该一河一策文件")){

                }
            }
        });
    }
}
